<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GdkRGB</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="index.html" title="GDK Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Bitmaps-and-Pixmaps.html" title="Bitmaps and Pixmaps">
<link rel="next" href="gdk-Images.html" title="Images">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="reference.html" title="API Reference">
<link rel="index" href="api-index-full.html" title="Index of all symbols">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Bitmaps-and-Pixmaps.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK Reference Manual</th>
<td><a accesskey="n" href="gdk-Images.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-GdkRGB.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#gdk-GdkRGB.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-GdkRGB"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-GdkRGB.top_of_page"></a>GdkRGB</span></h2>
<p>GdkRGB — Renders RGB, grayscale, or indexed image data to a GdkDrawable</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-GdkRGB.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk/gdk.h&gt;

void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-init" title="gdk_rgb_init ()">gdk_rgb_init</a>                        (void);

void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-image" title="gdk_draw_rgb_image ()">gdk_draw_rgb_image</a>                  (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-image-dithalign" title="gdk_draw_rgb_image_dithalign ()">gdk_draw_rgb_image_dithalign</a>        (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> ydith);
void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-indexed-image" title="gdk_draw_indexed_image ()">gdk_draw_indexed_image</a>              (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *cmap);
void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-gray-image" title="gdk_draw_gray_image ()">gdk_draw_gray_image</a>                 (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-32-image" title="gdk_draw_rgb_32_image ()">gdk_draw_rgb_32_image</a>               (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void                <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-32-image-dithalign" title="gdk_draw_rgb_32_image_dithalign ()">gdk_draw_rgb_32_image_dithalign</a>     (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> ydith);
enum                <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a>;

<a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *        <a class="link" href="gdk-GdkRGB.html#gdk-rgb-cmap-new" title="gdk_rgb_cmap_new ()">gdk_rgb_cmap_new</a>                    (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> *colors,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> n_colors);
void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-cmap-free" title="gdk_rgb_cmap_free ()">gdk_rgb_cmap_free</a>                   (<a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *cmap);
                    <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a>;

void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-gc-set-foreground" title="gdk_rgb_gc_set_foreground ()">gdk_rgb_gc_set_foreground</a>           (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-gc-set-background" title="gdk_rgb_gc_set_background ()">gdk_rgb_gc_set_background</a>           (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"
>gulong</a>              <a class="link" href="gdk-GdkRGB.html#gdk-rgb-xpixel-from-rgb" title="gdk_rgb_xpixel_from_rgb ()">gdk_rgb_xpixel_from_rgb</a>             (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-find-color" title="gdk_rgb_find_color ()">gdk_rgb_find_color</a>                  (<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *colormap,
                                                         <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor">GdkColor</a> *color);

void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-set-install" title="gdk_rgb_set_install ()">gdk_rgb_set_install</a>                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> install);
void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-set-min-colors" title="gdk_rgb_set_min_colors ()">gdk_rgb_set_min_colors</a>              (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> min_colors);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual">GdkVisual</a> *         <a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-visual" title="gdk_rgb_get_visual ()">gdk_rgb_get_visual</a>                  (void);
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *       <a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-colormap" title="gdk_rgb_get_colormap ()">gdk_rgb_get_colormap</a>                (void);
#define             <a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-cmap" title="gdk_rgb_get_cmap">gdk_rgb_get_cmap</a>
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-GdkRGB.html#gdk-rgb-ditherable" title="gdk_rgb_ditherable ()">gdk_rgb_ditherable</a>                  (void);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-GdkRGB.html#gdk-rgb-colormap-ditherable" title="gdk_rgb_colormap_ditherable ()">gdk_rgb_colormap_ditherable</a>         (<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *cmap);
void                <a class="link" href="gdk-GdkRGB.html#gdk-rgb-set-verbose" title="gdk_rgb_set_verbose ()">gdk_rgb_set_verbose</a>                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> verbose);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="gdk-GdkRGB.description"></a><h2>Description</h2>
<p>
GdkRGB is a low-level module which renders RGB, grayscale, and indexed
colormap images to a <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>. It does this as efficiently as
possible, handling issues such as colormaps, visuals, dithering,
temporary buffers, and so on. Most code should use the higher-level
<a
href="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a> features in place of this module; for example,
<a class="link" href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf" title="gdk_draw_pixbuf ()"><code class="function">gdk_draw_pixbuf()</code></a> uses GdkRGB in its implementation.
</p>
<p>
GdkRGB allocates a color cube to use when rendering images.  You can
set the threshold for installing colormaps with
<a class="link" href="gdk-GdkRGB.html#gdk-rgb-set-min-colors" title="gdk_rgb_set_min_colors ()"><code class="function">gdk_rgb_set_min_colors()</code></a>. The default is 5x5x5 (125). If a colorcube
of this size or larger can be allocated in the default colormap, then
that's done. Otherwise, GdkRGB creates its own private colormap.
Setting it to 0 means that it always tries to use the default
colormap, and setting it to 216 means that it always creates a private
one if it cannot allocate the 6x6x6 colormap in the default. If you
always want a private colormap (to avoid consuming too many colormap
entries for other apps, say), you can use
<code class="literal">gdk_rgb_set_install(TRUE)</code>.
Setting the value greater than 216 exercises a bug in older versions
of GdkRGB. Note, however, that setting it to 0 doesn't let you get
away with ignoring the colormap and visual - a colormap is always
created in grayscale and direct color modes, and the visual is changed
in cases where a "better" visual than the default is available.
</p>
<p>
If GDK is built with the Sun mediaLib library, the GdkRGB functions are
accelerated using mediaLib, which provides hardware acceleration on Intel,
AMD, and Sparc chipsets.  If desired, mediaLib support can be turned off
by setting the GDK_DISABLE_MEDIALIB environment variable.
</p>
<div class="example">
<a name="id2756022"></a><p class="title"><b>Example 4. A simple example program using GdkRGB</b></p>
<div class="example-contents"><pre class="programlisting">
#include &lt;gtk/gtk.h&gt;
#define IMAGE_WIDTH	256
#define IMAGE_HEIGHT	256
guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
gboolean on_darea_expose (GtkWidget *widget,
			  GdkEventExpose *event,
			  gpointer user_data);
int
main (int argc, char *argv[])
{
  GtkWidget *window, *darea;
  gint x, y;
  guchar *pos;
  gtk_init (&amp;argc, &amp;argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  darea = gtk_drawing_area_new ();
  gtk_widget_set_size_request (darea, IMAGE_WIDTH, IMAGE_HEIGHT);
  gtk_container_add (GTK_CONTAINER (window), darea);
  gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
                      GTK_SIGNAL_FUNC (on_darea_expose), NULL);
  gtk_widget_show_all (window);
  /* Set up the RGB buffer. */
  pos = rgbbuf;
  for (y = 0; y &lt; IMAGE_HEIGHT; y++)
    {
      for (x = 0; x &lt; IMAGE_WIDTH; x++)
	{
	  *pos++ = x - x % 32;			/* Red. */
	  *pos++ = (x / 32) * 4 + y - y % 32;	/* Green. */
	  *pos++ = y - y % 32;			/* Blue. */
	}
    }
  gtk_main ();
  return 0;
}
gboolean
on_darea_expose (GtkWidget *widget,
		 GdkEventExpose *event,
		 gpointer user_data)
{
  gdk_draw_rgb_image (widget-&gt;window, widget-&gt;style-&gt;fg_gc[GTK_STATE_NORMAL],
		      0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
		      GDK_RGB_DITHER_MAX, rgbbuf, IMAGE_WIDTH * 3);
  return TRUE;
}
</pre></div>
</div>
<br class="example-break">
</div>
<div class="refsect1" lang="en">
<a name="gdk-GdkRGB.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="gdk-rgb-init"></a><h3>gdk_rgb_init ()</h3>
<pre class="programlisting">void                gdk_rgb_init                        (void);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_init</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
This function no longer does anything at all. It's completely useless
(and harmless).
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-rgb-image"></a><h3>gdk_draw_rgb_image ()</h3>
<pre class="programlisting">void                gdk_draw_rgb_image                  (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws an RGB image in the drawable. This is the core GdkRGB
function, and likely the only one you will need to use.
</p>
<p>
The <em class="parameter"><code>rowstride</code></em> parameter allows for lines to be aligned more flexibly.
For example, lines may be allocated to begin on 32-bit boundaries,
even if the width of the rectangle is odd. Rowstride is also useful
when drawing a subrectangle of a larger image in memory. Finally, to
replicate the same line a number of times, the trick of setting
<em class="parameter"><code>rowstride</code></em> to 0 is allowed.
</p>
<p>
In general, for 0 &lt;= i &lt; <em class="parameter"><code>width</code></em> and 0 &lt;= j &lt; height,
the pixel (x + i, y + j) is colored with red value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> *
<em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3], green value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> * <em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3 +
1], and blue value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> * <em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3 + 2].
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The graphics context (all GDK drawing operations require one; its
contents are ignored).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td>A <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rgb_buf</code></em> :</span></p></td>
<td>The pixel data, represented as packed 24-bit data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>rgb_buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-rgb-image-dithalign"></a><h3>gdk_draw_rgb_image_dithalign ()</h3>
<pre class="programlisting">void                gdk_draw_rgb_image_dithalign        (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> ydith);</pre>
<p>
Draws an RGB image in the drawable, with an adjustment for dither alignment.
</p>
<p>
This function is useful when drawing dithered images into a window
that may be scrolled. Pixel (x, y) will be drawn dithered as if its
actual location is (x + <em class="parameter"><code>xdith</code></em>, y + <em class="parameter"><code>ydith</code></em>). Thus, if you draw an
image into a window using zero dither alignment, then scroll up one
pixel, subsequent draws to the window should have <em class="parameter"><code>ydith</code></em> = 1.
</p>
<p>
Setting the dither alignment correctly allows updating of small parts
of the screen while avoiding visible "seams" between the different
dither textures.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td>A <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rgb_buf</code></em> :</span></p></td>
<td>The pixel data, represented as packed 24-bit data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>rgb_buf</code></em> to the
start of the next.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>xdith</code></em> :</span></p></td>
<td>An x offset for dither alignment.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ydith</code></em> :</span></p></td>
<td>A y offset for dither alignment.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-indexed-image"></a><h3>gdk_draw_indexed_image ()</h3>
<pre class="programlisting">void                gdk_draw_indexed_image              (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *cmap);</pre>
<p>
Draws an indexed image in the drawable, using a <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> to assign
actual colors to the color indices.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td>A <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>The pixel data, represented as 8-bit color indices.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> used to assign colors to the color indices.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-gray-image"></a><h3>gdk_draw_gray_image ()</h3>
<pre class="programlisting">void                gdk_draw_gray_image                 (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws a grayscale image in the drawable.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td>A <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>The pixel data, represented as 8-bit gray values.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-rgb-32-image"></a><h3>gdk_draw_rgb_32_image ()</h3>
<pre class="programlisting">void                gdk_draw_rgb_32_image               (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws a padded RGB image in the drawable. The image is stored as one
pixel per 32-bit word. It is laid out as a red byte, a green byte, a
blue byte, and a padding byte.
</p>
<p>
It's unlikely that this function will give significant performance
gains in practice. In my experience, the performance gain from having
pixels aligned to 32-bit boundaries is cancelled out by the increased
memory bandwidth.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td>A <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>The pixel data, represented as padded 32-bit data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-draw-rgb-32-image-dithalign"></a><h3>gdk_draw_rgb_32_image_dithalign ()</h3>
<pre class="programlisting">void                gdk_draw_rgb_32_image_dithalign     (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
                                                         <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> x,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> y,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> width,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> height,
                                                         <a class="link" href="gdk-GdkRGB.html#GdkRgbDither" title="enum GdkRgbDither">GdkRgbDither</a> dith,
                                                         const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> ydith);</pre>
<p>
Like <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-32-image" title="gdk_draw_rgb_32_image ()"><code class="function">gdk_draw_rgb_32_image()</code></a>, but allows you to specify the dither
offsets. See <a class="link" href="gdk-GdkRGB.html#gdk-draw-rgb-image-dithalign" title="gdk_draw_rgb_image_dithalign ()"><code class="function">gdk_draw_rgb_image_dithalign()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td> X coordinate on <em class="parameter"><code>drawable</code></em> where image should go
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td> Y coordinate on <em class="parameter"><code>drawable</code></em> where image should go
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> width of area of image to draw
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> height of area of image to draw
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dith</code></em> :</span></p></td>
<td> dithering mode
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td> RGB image data
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rowstride</code></em> :</span></p></td>
<td> rowstride of RGB image data
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>xdith</code></em> :</span></p></td>
<td> X dither offset
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ydith</code></em> :</span></p></td>
<td> Y dither offset
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkRgbDither"></a><h3>enum GdkRgbDither</h3>
<pre class="programlisting">typedef enum
{
  GDK_RGB_DITHER_NONE,
  GDK_RGB_DITHER_NORMAL,
  GDK_RGB_DITHER_MAX
} GdkRgbDither;
</pre>
<p>
Selects whether or not GdkRGB applies dithering
to the image on display.
</p>
<p>
Since GdkRGB currently only handles images with 8 bits per component,
dithering on 24 bit per pixel displays is a moot point.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-RGB-DITHER-NONE--CAPS"></a><span class="term"><code class="literal">GDK_RGB_DITHER_NONE</code></span></p></td>
<td>Never use dithering.
</td>
</tr>
<tr>
<td><p><a name="GDK-RGB-DITHER-NORMAL--CAPS"></a><span class="term"><code class="literal">GDK_RGB_DITHER_NORMAL</code></span></p></td>
<td>Use dithering in 8 bits per pixel (and below)
only.
</td>
</tr>
<tr>
<td><p><a name="GDK-RGB-DITHER-MAX--CAPS"></a><span class="term"><code class="literal">GDK_RGB_DITHER_MAX</code></span></p></td>
<td>Use dithering in 16 bits per pixel and below.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-cmap-new"></a><h3>gdk_rgb_cmap_new ()</h3>
<pre class="programlisting"><a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *        gdk_rgb_cmap_new                    (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> *colors,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> n_colors);</pre>
<p>
Creates a new <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> structure. The cmap maps color indexes to
RGB colors. If <em class="parameter"><code>n_colors</code></em> is less than 256, then images containing
color values greater than or equal to <em class="parameter"><code>n_colors</code></em> will produce undefined
results, including possibly segfaults.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colors</code></em> :</span></p></td>
<td>The colors, represented as 0xRRGGBB integer values.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_colors</code></em> :</span></p></td>
<td>The number of colors in the cmap.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The newly created <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-cmap-free"></a><h3>gdk_rgb_cmap_free ()</h3>
<pre class="programlisting">void                gdk_rgb_cmap_free                   (<a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap">GdkRgbCmap</a> *cmap);</pre>
<p>
Frees the memory associated with a <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> created by <a class="link" href="gdk-GdkRGB.html#gdk-rgb-cmap-new" title="gdk_rgb_cmap_new ()"><code class="function">gdk_rgb_cmap_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-GdkRGB.html#GdkRgbCmap" title="GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> to free.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkRgbCmap"></a><h3>GdkRgbCmap</h3>
<pre class="programlisting">typedef struct {
  guint32 colors[256];
  gint n_colors;
} GdkRgbCmap;
</pre>
<p>
A private data structure which maps color indices to actual RGB
colors. This is used only for <a class="link" href="gdk-GdkRGB.html#gdk-draw-indexed-image" title="gdk_draw_indexed_image ()"><code class="function">gdk_draw_indexed_image()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> <em class="structfield"><code>colors</code></em>[256];</span></p></td>
<td>The colors, represented as 0xRRGGBB integer values.
</td>
</tr>
<tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> <em class="structfield"><code>n_colors</code></em>;</span></p></td>
<td>The number of colors in the cmap.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-gc-set-foreground"></a><h3>gdk_rgb_gc_set_foreground ()</h3>
<pre class="programlisting">void                gdk_rgb_gc_set_foreground           (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_gc_set_foreground</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Sets the foreground color in <em class="parameter"><code>gc</code></em> to the specified color (or the
closest approximation, in the case of limited visuals).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> to modify.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rgb</code></em> :</span></p></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-gc-set-background"></a><h3>gdk_rgb_gc_set_background ()</h3>
<pre class="programlisting">void                gdk_rgb_gc_set_background           (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_gc_set_background</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Sets the background color in <em class="parameter"><code>gc</code></em> to the specified color (or the
closest approximation, in the case of limited visuals).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td>The <a class="link" href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> to modify.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rgb</code></em> :</span></p></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-xpixel-from-rgb"></a><h3>gdk_rgb_xpixel_from_rgb ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"
>gulong</a>              gdk_rgb_xpixel_from_rgb             (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_xpixel_from_rgb</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Finds the X pixel closest in color to the <em class="parameter"><code>rgb</code></em> color specified. This
value may be used to set the <em class="structfield"><code>pixel</code></em> field of
a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> struct.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>rgb</code></em> :</span></p></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The X pixel value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-find-color"></a><h3>gdk_rgb_find_color ()</h3>
<pre class="programlisting">void                gdk_rgb_find_color                  (<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *colormap,
                                                         <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor">GdkColor</a> *color);</pre>
<p>
<em class="parameter"><code>colormap</code></em> should be the colormap for the graphics context and
drawable you're using to draw. If you're drawing to a <a
href="/usr/share/gtk-doc/html/gtk/GtkWidget.html"
><span class="type">GtkWidget</span></a>,
call <a
href="/usr/share/gtk-doc/html/gtk/GtkWidget.html#gtk-widget-get-colormap"
><code class="function">gtk_widget_get_colormap()</code></a>.
</p>
<p>
<em class="parameter"><code>color</code></em> should have its <code class="literal">red</code>, <code class="literal">green</code>, and <code class="literal">blue</code> fields initialized;
<a class="link" href="gdk-GdkRGB.html#gdk-rgb-find-color" title="gdk_rgb_find_color ()"><code class="function">gdk_rgb_find_color()</code></a> will fill in the <code class="literal">pixel</code> field with the best
matching pixel from a color cube. The color is then ready to be
used for drawing, e.g. you can call <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-foreground" title="gdk_gc_set_foreground ()"><code class="function">gdk_gc_set_foreground()</code></a> which
expects <code class="literal">pixel</code> to be initialized.
</p>
<p>
In many cases, you can avoid this whole issue by calling
<a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-fg-color" title="gdk_gc_set_rgb_fg_color ()"><code class="function">gdk_gc_set_rgb_fg_color()</code></a> or <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-bg-color" title="gdk_gc_set_rgb_bg_color ()"><code class="function">gdk_gc_set_rgb_bg_color()</code></a>, which
do not expect <code class="literal">pixel</code> to be initialized in advance. If you use those
functions, there's no need for <a class="link" href="gdk-GdkRGB.html#gdk-rgb-find-color" title="gdk_rgb_find_color ()"><code class="function">gdk_rgb_find_color()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-set-install"></a><h3>gdk_rgb_set_install ()</h3>
<pre class="programlisting">void                gdk_rgb_set_install                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> install);</pre>
<p>
If <em class="parameter"><code>install</code></em> is <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a>, directs GdkRGB to always install a new "private"
colormap rather than trying to find a best fit with the colors already
allocated. Ordinarily, GdkRGB will install a colormap only if a
sufficient cube cannot be allocated.
</p>
<p>
A private colormap has more colors, leading to better quality display,
but also leads to the dreaded "colormap flashing" effect.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>install</code></em> :</span></p></td>
<td>%TRUE to set install mode.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-set-min-colors"></a><h3>gdk_rgb_set_min_colors ()</h3>
<pre class="programlisting">void                gdk_rgb_set_min_colors              (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> min_colors);</pre>
<p>
Sets the minimum number of colors for the color cube. Generally,
GdkRGB tries to allocate the largest color cube it can. If it can't
allocate a color cube at least as large as <em class="parameter"><code>min_colors</code></em>, it installs a
private colormap.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>min_colors</code></em> :</span></p></td>
<td>The minimum number of colors accepted.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-get-visual"></a><h3>gdk_rgb_get_visual ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual">GdkVisual</a> *         gdk_rgb_get_visual                  (void);</pre>
<p>
Gets a "preferred visual" chosen by GdkRGB for rendering image data
on the default screen. In previous versions of GDK, this was the
only visual GdkRGB could use for rendering. In current versions,
it's simply the visual GdkRGB would have chosen as the optimal one
in those previous versions. GdkRGB can now render to drawables with
any visual.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> chosen by GdkRGB.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-get-colormap"></a><h3>gdk_rgb_get_colormap ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *       gdk_rgb_get_colormap                (void);</pre>
<p>
Get the preferred colormap for rendering image data.  Not a
very useful function; historically, GDK could only render RGB image
data to one colormap and visual, but in the current version it can
render to any colormap and visual. So there's no need to call this
function.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the preferred colormap
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-get-cmap"></a><h3>gdk_rgb_get_cmap</h3>
<pre class="programlisting">#define gdk_rgb_get_cmap               gdk_rgb_get_colormap
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_get_cmap</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Gets the colormap set by GdkRGB. This colormap and the corresponding
visual should be used when creating windows that will be drawn in by GdkRGB.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> set by GdkRGB.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-ditherable"></a><h3>gdk_rgb_ditherable ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_rgb_ditherable                  (void);</pre>
<p>
Determines whether the preferred visual is ditherable. This function may be
useful for presenting a user interface choice to the user about which
dither mode is desired; if the display is not ditherable, it may make
sense to gray out or hide the corresponding UI widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>%TRUE if the preferred visual is ditherable.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-colormap-ditherable"></a><h3>gdk_rgb_colormap_ditherable ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_rgb_colormap_ditherable         (<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a> *cmap);</pre>
<p>
Determines whether the visual associated with <em class="parameter"><code>cmap</code></em> is ditherable. This
function may be useful for presenting a user interface choice to the user
about which dither mode is desired; if the display is not ditherable, it may
make sense to gray out or hide the corresponding UI widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>%TRUE if the visual associated with <em class="parameter"><code>cmap</code></em> is ditherable.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-rgb-set-verbose"></a><h3>gdk_rgb_set_verbose ()</h3>
<pre class="programlisting">void                gdk_rgb_set_verbose                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> verbose);</pre>
<p>
Sets the "verbose" flag. This is generally only useful for debugging.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>verbose</code></em> :</span></p></td>
<td>%TRUE if verbose messages are desired.
</td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="gdk-GdkRGB.see-also"></a><h2>See Also</h2>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></span></p></td>
<td><p>The underlying GDK mechanism for allocating
colors.</p></td>
</tr>
<tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a> and <a class="link" href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf" title="gdk_draw_pixbuf ()"><code class="function">gdk_draw_pixbuf()</code></a></span></p></td>
<td><p>Higher-level image handling.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>
